package com.potevio.simulator.controller;

import com.potevio.simulator.common.R;
import com.potevio.simulator.util.HexUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @CreateDate: 2022/11/2 14:57
 * @Author: tbh
 */
@RestController
@Slf4j
public class TestController {


    private static final Logger log = LoggerFactory.getLogger(TestController.class);
    @RequestMapping("/test")
    public R workTest() {
        log.info("000000000");
        System.out.println("0000");
        return R.ok();
    }

    @RequestMapping("/test2")
    public R workTest2(@RequestBody Student student) {
        log.info("名称{}-开始时间{}",student.getName(),student.getStartTime());
        return R.ok();
    }

    //校验和域
    @RequestMapping("/test3")
    public R workTest3(String str) {
        String checkSumDomain = HexUtil.getCheckSumDomain(str.substring(4, str.length()));
        System.out.println("校验和域=="+checkSumDomain);
        return R.ok();
    }

    @RequestMapping("/insertOriginalMsg")
    public R workTest(@RequestParam String flag,@RequestParam String beginDate){
        log.info("flag={}",flag);
        return R.ok();
    }
}
